
// 封装请求地址
import axios from "axios"

const instance = axios.create({
    baseURL: "/api"
})

instance.interceptors.request.use(config=>{
    // 取token
    let token=localStorage.getItem("x-auth-token")
    console.log(token);
    // 如果有token 发送请求时就携带上
    if(token){
     config.headers["x-auth-token"]=token;
    }
    return config;
},err=>{
    return Promise.reject(err)
})

export default instance


// /api